$(function () {
    var username = getCookie('username')
    if (username) {
        $('.customNav').html(`
        欢迎你，<span style="font-size:14px;color:red;">${username}</span>      

        </a>&nbsp;&nbsp;&nbsp;
        <a title="退出" href="" class="logout">退出</a>
        `)
        $('.denglu').html(`
        ${username}
        `)

        $('.logout').click(function () {
            removeCookie('username')
            $('.customNav').html(`
            您还未登录，请
            <a title="登录" href="javascript:;">登录</a>

            <a title="注册" href="register.html">注册</a>
            `)
            gologin()
        })

    } else {
        layer.msg('请先登录！！！', {
            icon: 2,
            time: 1500
        }, function () {
            localStorage.setItem('url', location.href)
            location.href = "login.html";
        })
    }
    gologin()
})